package com.itheima.mapper;

import com.itheima.pojo.StaffPage;
import com.itheima.pojo.Staff;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import java.util.List;

/**
 * @author Envy
 */
@Mapper
public interface StaffMapper {
    /**
     * 登录功能
     */
    @Select("select * from staff where username=#{username } and password = #{password}")
    Staff login(Staff staff);


    /**
     * 新增员工
     */
    @Insert("insert into staff(id,name,phone,sex,idNumber,username)values ( #{id}, #{name},#{phone},#{sex},#{idNumber},#{username})")
    int addStaff(Staff staff);


    /**
     * 分页查询员工
     */
    List<StaffPage> pageQuery(String name, Integer page, Integer pageSize);

    /**
     * 统计页面数量
     */
    @Select("select count(*) from staff")
    int count();

    /**
     * 根据Id查询员工信息
     */
    @Select("select * from staff where id =#{id}")
    Staff selectInfo(String id);


    /**
     * 修改员工信息/状态
     */
    int update(Staff staff);
}


